package com.xinpu.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xinpu.dto.PhotoDto;
import com.xinpu.entity.TPhotoBrowse;
import com.xinpu.mapper.PhotoMapper;
import com.xinpu.service.PhotoService;
import com.xinpu.vo.PhotoVo;
import com.xinpu.vo.SalesPhotoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * PhotoServiceImpl
 *
 * @author ayuan
 * @date 2021/5/11
 */
@Service
public class PhotoServiceImpl implements PhotoService {

    @Autowired
    private PhotoMapper photoMapper;


    /**
     * 图文列表
     *
     * @param page
     * @return
     */
    @Override
    public IPage<PhotoDto> getList(Page<PhotoDto> page, String name, Integer cid) {
        return photoMapper.getList(page, name, cid);
    }

    /**
     * 图文浏览总数
     *
     * @param id
     * @return
     */
    @Override
    public PhotoVo photo(Integer id) {
        return photoMapper.photo(id);
    }

    /**
     * 销售员转发此图文的浏览信息
     *
     * @param id
     * @return
     */
    @Override
    public IPage<SalesPhotoVo> salesPhoto(Integer id, String name, Integer page, Integer size) {
        return photoMapper.salesPhoto(id, name, new Page<>(page, size));
    }

    @Override
    public Integer num(String tenantId, String date) {
        return photoMapper.num(tenantId, date);
    }

    @Override
    public IPage<TPhotoBrowse> photoList(Integer id, String tenantId, Integer page, Integer size) {
        return photoMapper.photoList(id, tenantId, new Page<>(page, size));
    }

}
